import 'package:favor_cate/core/model/category_model.dart';
import 'package:favor_cate/ui/pages/meal/meal.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:favor_cate/core/extension/int_extension.dart';

class HomeCategoryItem extends StatelessWidget {
  final CategoryModel _categoryItem;

  HomeCategoryItem(this._categoryItem);


  @override
  Widget build(BuildContext context) {
    final bgColor = _categoryItem.cColor;
    return GestureDetector(
      child: Container(
        decoration: BoxDecoration(
            color: bgColor,
            borderRadius: BorderRadius.circular(20.px),
            gradient: LinearGradient(
                colors: [
                  bgColor.withOpacity(.5),
                  bgColor
                ]
            )
        ),
        alignment: Alignment.center,
        child: Text(
          _categoryItem.title,
          style: Theme.of(context).textTheme.headline1!.copyWith(
              fontWeight: FontWeight.bold
          ),
        ),
      ),
      onTap: () {
        Navigator.of(context).pushNamed(MealScreen.routeName, arguments: _categoryItem);
      },
    );
  }
}
